package com.eleventwelve.iris.web.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.eleventwelve.iris.entity.Patient;

public class PatientValidator implements Validator{

	@Override
	public boolean supports(Class<?> arg0) {
		return Patient.class.isAssignableFrom(arg0);
	}

	@Override
	public void validate(Object obj, Errors err) {
		ValidationUtils.rejectIfEmptyOrWhitespace(err, "firstName", "error.required-field", new Object[]{"First Name"});
		ValidationUtils.rejectIfEmptyOrWhitespace(err, "lastName", "error.required-field", new Object[]{"Last Name"});
	}

}
